import React, { Component } from 'react';
import {HashRouter as Router, Route, Switch} from 'react-router-dom';
import App from './App';
// 公共组件
import Admin from './Admin';
import Login from './pages/login';
import Home from './pages/home/home';
import Buttons from './pages/ui/buttons'
import Modals from './pages/ui/modals';
import Loadings from './pages/ui/loadings';
import Notifications from './pages/ui/notifications';
import Messages from './pages/ui/messages';
import Tabs from './pages/ui/tabs';
import Carousel from './pages/ui/carousel';
import Gallery from './pages/ui/gallery';
import FormLogin from './pages/form/login';
import Register from './pages/form/register';
import basicTable from './pages/table/basicTable';
import highTable from './pages/table/highTable';
import City from './pages/city';
import Order from './pages/order';
import NoMatch from './pages/nomatch';
// 通用组件
import Common from './common';
import OrderDetail from './pages/order/detail';

// demo
import Life from './pages/demo/Life';
class IRouter extends Component {
    render() {
        return (
            <Router>
                <App>
                    <Route path="/login" component={Login}/>
                    <Route path="/life" component={Life}/>
                    <Route path="/admin" render={()=> 
                        <Admin>
                            <Switch>
                                <Route path="/admin/home" component={Home}></Route>
                                <Route path="/admin/ui/buttons" component={Buttons}></Route>
                                <Route path="/admin/ui/modals" component={Modals}></Route>
                                <Route path="/admin/ui/loadings" component={Loadings}></Route>
                                <Route path="/admin/ui/notifications" component={Notifications}></Route>
                                <Route path="/admin/ui/messages" component={Messages}></Route>
                                <Route path="/admin/ui/tabs" component={Tabs}></Route>
                                <Route path="/admin/ui/gallery" component={Gallery}></Route>
                                <Route path="/admin/ui/carousel" component={Carousel}></Route>
                                <Route path="/admin/form/login" component={FormLogin}></Route>
                                <Route path="/admin/form/register" component={Register}></Route>
                                <Route path="/admin/table/basic" component={basicTable}></Route>
                                <Route path="/admin/table/high" component={highTable}></Route>
                                <Route path="/admin/city" component={City}></Route>
                                <Route path="/admin/order" component={Order}></Route>
                                <Route component={NoMatch}></Route>
                            </Switch>
                        </Admin>
                    }></Route>
                    <Route path="/common" render={()=>
                        <Common>
                            <Route path="/common/order/detail/:orderId" component={OrderDetail}></Route>   
                        </Common>
                    }></Route>
                </App>
            </Router>
        );
    }
}

export default IRouter;